#ifndef TYPE_H
#define TYPE_H

#include "Object.h"

typedef struct Type{
    OBJECT_HEAD
    struct List* mro; //方法解析顺序表
    struct List* parents;   //父类继承表
	char* name;     // 类型名字

	/********** 实例化  *******/
	Object* (*allocate_instance)(Object*);

    /******** 属性操作 *******/
	Object* (*getattr)(Object*, Object*);
	void (*setattr)(Object*, Object*, Object*);
    void (*delattr)(Object*, Object*);

    /*********算数虚函数的实现加减乘除、打印、hash函数***/
	void (*print)(Object*);
    Object* (*add) (Object*, Object*);
	Object* (*sub)(Object*, Object*);
	Object* (*mul)(Object*, Object*);
	Object* (*div)(Object*, Object*);
	int (*hash)(Object*);
	
	/*************逻辑比较虚函数的实现***********/
	Object* (*equal)(Object*, Object*);
	Object* (*neq)(Object*,Object*);
	Object* (*greater)(Object*, Object*);
	Object* (*less)(Object*, Object*);
	Object* (*ge)(Object*,Object*);
	Object* (*le)(Object*,Object*);

	/************下标操作****************/
	Object* (*setitem)(Object*, Object*, Object*);
	Object* (*getitem)(Object*, Object*);
	Object* (*delitem)(Object*, Object*);

	
}Type;


Type* type_allocate(Object* , Object*, Object*);

Object* type_allocate_instance(Object*);

Object* getattr(Object* oop, Object* name);

void setattr(Object* oop, Object* name, Object* attr);

void delattr(Object* oop, Object* name);


#endif

